import { set } from 'nuxt/dist/app/compat/capi'
import { defineStore, acceptHMRUpdate } from 'pinia'
import img1 from '@/assets/image/img／defaultAvatar@2x.png';
const imagesicon = ref(img1)
 export const useStore = defineStore('main', {
   // state definition
   state: () => ({
     count: 0,
     name: 'John',
     isPc: '',
     token: '' ,
     userInfo:{
      headimage:imagesicon ,
      nickname:'新用户'     
     },
     dialogVisible: false,
   }),      

   // getters
   getters: {
     doubleCount: (state) => state.count * 2
   },

   // actions
   actions: {       
    setdialogVisible(newMessage:boolean) {
      this.dialogVisible = newMessage;
      console.log(this.dialogVisible);
    },      
     increment(amount: number) {
       this.count += amount
     },
     setName(name: string) {
       this.name = name
     },
     setIsPc(isPc: string){
       this.isPc = isPc
     },
     setToken(token: string){
       this.token = token;
     },
     setUserInfo(userInfo: any){
       this.userInfo = userInfo;
     }
   }
 })

if (import.meta.hot) {
  import.meta.hot.accept(acceptHMRUpdate(useStore, import.meta.hot))
}  